package com.goods.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiaZhenpeng
 * @Title: GoodsController
 * @Package com.goods.controller
 * @Description: 控制层
 * @date 2022/11/17 18:31
 */
@Slf4j
@RestController
@RequestMapping("/goods")
public class GoodsController {



    @GetMapping("/getGoods/{id}")
    public String getGoods(@PathVariable("id") Long id) throws InterruptedException {
        log.info("getGoods ...");
        if (id == 1){
            Thread.sleep(60);
        }else if (id == 2){
            throw new RuntimeException("故意出错，触发熔断！！");
        }
        return "获取商品成功。。";
    }

}
